﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;

namespace PressMenu2
{
    class MyKeyboard
    {
        KeyboardState oldKeyState, newKeyState;
        public void Update()
        {
            oldKeyState = newKeyState;
            newKeyState = Keyboard.GetState();
        }

        public bool IsKeyDown(Keys key)
        {
            return newKeyState.IsKeyDown(key);
        }

        public bool IsKeyPress(Keys key)
        {
            if (oldKeyState.IsKeyUp(key))
                if (newKeyState.IsKeyDown(key))
                    return true;
            return false;
        }

        public MyKeyboard()
        {
            oldKeyState = new KeyboardState();
            newKeyState = new KeyboardState();
            oldKeyState = Keyboard.GetState();
        }
    }
}
